import time

import numba as nb


@nb.jit
def _calc(n, a):  # 在外部写一个函数
    for _ in range(n):
        a += 1
    return a


class A():
    def __init__(self):
        self.a = 1
        self.n = 10000000

    def calc(self):  # 类中调用外部的函数
        self.a = _calc(self.n, self.a)


if __name__ == '__main__':
    start = time.process_time()
    a = A()
    a.calc()
    end = time.process_time()
    print('finish all in %s' % str(end - start))
